var log = console.log.bind(console)
var imageFromPath = function (path) {
  var img = new Image()
  img.src = path
  return img
}

function collide(a, b) {
  var maxX, maxY, minX, minY

  maxX = a.x + a.width >= b.x + b.width ? a.x + a.width : b.x + b.width
  maxY = a.y + a.height >= b.y + b.height ? a.y + a.height : b.y + b.height
  minX = a.x <= b.x ? a.x : b.x
  minY = a.y <= b.y ? a.y : b.y

  if (maxX - minX <= a.width + b.width && maxY - minY <= a.height + b.height) {
    return true
  } else {
    return false
  }
}